#
# @lc app=leetcode.cn id=718 lang=python
#
# [718] 最长重复子数组
#

# @lc code=start
class Solution(object):
    def findLength(self, nums1, nums2):
        """
        :type nums1: List[int]
        :type nums2: List[int]
        :rtype: int
        """
        dp = [[0] * (len(nums2)+1) for _ in range(len(nums1)+1)]
        result = 0
        for i in range(len(nums1)):
            for j in range(len(nums2)):
                if nums1[i] == nums2[j]:
                    dp[i+1][j+1] = dp[i][j] + 1
            temp = max(dp[i+1])
            result = max(temp, result)
        return result
        
# @lc code=end

